#ifndef PHYSICSMANAGER_H
#define PHYSICSMANAGER_H

#include <OgreBullet/Dynamics/OgreBulletDynamicsRigidBody.h>
#include <OgreSceneManager.h>
#include <QTimer>


class PhysicsManager
{
public:
    static PhysicsManager *CreateInstance(Ogre::SceneManager *p_SceneManager);
    static PhysicsManager *GetInstance() { return m_Instance; }
    void RemoveAndDestroyChildren();

    void AddStaticEntity(Ogre::Entity *p_Entity);
    void AddMovableEntity(Ogre::Entity *p_Entity);

	void Collide();

	OgreBulletDynamics::DynamicsWorld *GetDynamicsWorld() { return m_DynamicsWorld; }

private:
    PhysicsManager(Ogre::SceneManager *p_SceneManager);
    ~PhysicsManager();

    static PhysicsManager *m_Instance;

	std::deque<OgreBulletDynamics::RigidBody *>         m_Bodies;
	std::deque<OgreBulletCollisions::CollisionShape *>  m_Shapes;

	OgreBulletDynamics::DynamicsWorld *m_DynamicsWorld;
	OgreBulletCollisions::DebugDrawer *m_DebugDrawer;
	Ogre::SceneManager* m_SceneManager;
};

#endif // PHYSICSMANAGER_H
